package workload

import (
	k8sclient "k8s_gui_client/k8s/client"
)

//job list
func GetJobs(namespace string  ) (map[string]interface{},error){

	if namespace != "" {
	   return  k8sclient.CurrentK8sApiClient.GetAPI("/apis/batch/v1/namespaces/"+namespace+"/jobs")
	} else {
	   return  k8sclient.CurrentK8sApiClient.GetAPI("/apis/batch/v1/jobs")
		
	}
	
	
}

func JobURL(namespace string, name string) string {
	return "/apis/batch/v1/namespaces/" + namespace + "/jobs/" + name
}

func GetJobYaml(namespace string,name string) (string ,error){
    return k8sclient.CurrentK8sApiClient.GetAPIAsYaml(JobURL(namespace,name))
}